#ifndef MSG_QUEUE_HPP_
#define MSG_QUEUE_HPP_

#include <boost/thread/mutex.hpp>
#include <list>

struct IMediaBuffer
{
public:
    IMediaBuffer()
    {

    }
    virtual ~IMediaBuffer()
    {

    }
private:
    int a;
};

// 
class CBufQueue
{
private:
	std::list<IMediaBuffer*>    m_list;
	boost::mutex                m_mutex;
	uint32_t                    m_size;

public:
	CBufQueue();
	virtual ~CBufQueue();

	void push( IMediaBuffer *&buf );
	bool pop( IMediaBuffer *&buf );
	//bool pop( IMediaBuffer *&buf, uint32_t size );

	bool empty();
	uint32_t size();
};

class CBufList
{
    enum{
        BUF_SIZE=512
    };
private:
    IMediaBuffer*       m_buf[BUF_SIZE];
    uint16_t            m_size;
    uint16_t            m_head;
    uint16_t            m_tail;
    boost::mutex        m_mutex;
public:
    CBufList();
    virtual ~CBufList();

    bool push( IMediaBuffer *&buf );
    bool pop( IMediaBuffer *&buf );
    //bool pop( IMediaBuffer *&buf, uint32_t size );
    uint16_t size();
};


#endif // MSG_QUEUE_HPP_
